<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<div class="modal-dialog ms-modal-dialog" style = "width:800px;">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
        <h4 class="modal-title">创建过往业务信息</h4>
      </div>

      <form class="form-horizontal ms-form modal-search-form" role="form" method="POST" action="${ctx.host}/suppliers/${supplier.id}/business-history"
            data-validate="true" data-anchor="#anchor-business-history">
      
       <input type="hidden" name="supplier" value="${supplier.id}" />
        
       <div class="modal-body">
         
         <div class="form-group ms-form-group">
           <label class="control-label col-xs-3 ">1&nbsp;<span class="color-red">*</span>合同开始日期：</label>
           <div class="col-xs-3 pull-left">
             <input type="text" name="startDate" class="form-control date" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
           </div>
           
           <label class="control-label col-xs-2 ">2&nbsp;<span class="color-red">*</span>合同结束时间：</label>
           <div class="col-xs-3 pull-left">
             <input type="text" name="endDate" class="form-control date" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
           </div>
         </div>
         
         <div class="form-group ms-form-group">
           <label class="control-label col-xs-3 ">3&nbsp;<span class="color-red">*</span>合同甲方：</label>
           <div class="col-xs-3 pull-left">
             <input type="text" name="consignor" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
           </div>
           
           <label class="control-label col-xs-2 ">4&nbsp;<span class="color-red">*</span>合同乙方：</label>
           <div class="col-xs-3 pull-left">
             <input type="text" name="executor" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
           </div>
         </div>

         <div class="form-group  ms-form-group">
           <label class="control-label col-xs-3">5&nbsp;<span class="color-red">*</span>承运品牌：</label>
           <div class="col-xs-3 pull-left">
             <input type="text" name="brand" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
           </div>
           
           <c:if test="${type eq 'trans'}">
             <label class="control-label col-xs-2">6&nbsp;<span class="color-red">*</span>业务类型：</label>
             <div class="col-xs-3 pull-left">
               <select class="select2 form-control" name="transType"  data-validate="required" tabindex="1">
                 <option></option>
                 <c:forEach var="transType" items="${enums['SupplierTransType'] }">
                   <option value="${transType}">${transType.description}</option>
                 </c:forEach>
               </select>
             </div>
           </c:if>
           
           <c:if test="${type eq 'ware'}">
             <label class="control-label col-xs-2">6&nbsp;<span class="color-red">*</span>业务类型：</label>
             <div class="col-xs-3 pull-left">
               <select class="select2 form-control" name="wareType"  data-validate="required" tabindex="1">
                 <option></option>
                 <c:forEach var="wareType" items="${enums['SupplierWareType'] }">
                   <option value="${wareType}">${wareType.description}</option>
                 </c:forEach>
               </select>
             </div>
           </c:if>
         </div>
    
         <c:if test="${type eq 'trans'}">
         
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3" >7&nbsp;<span class="color-red">*</span>出发地：</label>
            <div class="col-xs-3 pull-left">
              <input type="text" name="fromLoadPlace" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
            </div>
            
            <label class="control-label col-xs-2">8&nbsp;<span class="color-red">*</span>目的地：</label>
            <div class="col-xs-3 pull-left">
              <input type="text" name="toLoadPlace" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
            </div>
          </div>
          
          <div class="form-group  ms-form-group">
            <label class="control-label col-xs-3">9&nbsp;<span class="color-red">*</span>投入运力板：</label>
             <div class="col-xs-3 pull-left">
               <input type="text" name="vehicleNum" class="form-control" data-validate="required|number" placeholder="" tabindex="1" autocomplete="off"/>
             </div>
             
             <label class="control-label col-xs-2">10&nbsp;<span class="color-red">*</span>月均运量：</label>
             <div class="col-xs-3 pull-left">
               <input type="text" name="averageCapacity" class="form-control" data-validate="required|number" placeholder="" tabindex="1" autocomplete="off"/>
             </div>
          </div>
          
        </c:if>
            
        <c:if test="${type eq 'ware'}">
         
           <div class="form-group ms-form-group">
             <label class="control-label col-xs-3" >7&nbsp;<span class="color-red">*</span>服务仓库所在地：</label>
             <div class="col-xs-3 pull-left">
               <input type="text" name="serviceLocation" class="form-control" data-validate="required" placeholder="" tabindex="1" autocomplete="off"/>
             </div>
             
             <label class="control-label col-xs-2">8&nbsp;<span class="color-red">*</span>投入人员：</label>
             <div class="col-xs-3 pull-left">
               <input type="text" name="staffNum" class="form-control" data-validate="required|number" placeholder="" tabindex="1" autocomplete="off"/>
             </div>
           </div>
           
           <div class="form-group ms-form-group">
             <label class="control-label col-xs-3">9&nbsp;<span class="color-red">*</span>月均业务量：</label>
             <div class="col-xs-3 pull-left">
               <input type="text" name="averageTraffic" class="form-control" data-validate="required|number" placeholder="" tabindex="1" autocomplete="off"/>
             </div>
           </div>
           
         </c:if>
          
        <div class="modal-footer ms-modal-footer">
          <button type="submit" class="btn ms-btn btn-primary">确定</button>
          <button type="button" class="btn ms-btn ms-btn-gary" data-dismiss="modal">取消</button>
        </div>
        
      </div>
       
    </form>
     
  </div>
</div>

<script type="text/javascript">
  $(document).ready(function () {

    $('select[name="transType"]').select2({
      theme: "classic",
      placeholder: '请选择',
      minimumResultsForSearch: -1,
      allowClear: true,
    });

    $('select[name="wareType"]').select2({
      theme: "classic",
      placeholder: '请选择',
      minimumResultsForSearch: -1,
      allowClear: true,
    });
    
    $('.date').datetimepicker({
      format: 'yyyy-mm-dd',
      autoclose: true,
      language: 'zh-CN',
      todayBtn: 'linked',
      startDate: '${today}',
      todayHighlight: true,
      pickerPosition: 'bottom-right',
      minView: 'month'
    });

  })
</script>